﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace QuanLyKhachHang.Data
{
    class TTWGhiChu
    {
        public string Code, MaWeb, GhiChu;
        public DateTime ThoiGian;
      public  TTWGhiChu() { }
       public TTWGhiChu(string Code, string MaWeb, DateTime ThoiGian, string GhiChu)
        {
            this.Code = Code;
            this.MaWeb = MaWeb;
            this.ThoiGian = ThoiGian;
            this.GhiChu = GhiChu;
        }
    }
    class NVWGhiChu
    {
        public static DataTable ChonTatCa()
        {
            return Connect.cnSQL.ExecQuery("Select * from WGhiChu");
        }
        public static DataTable ChonTatCa(string MaWeb)
        {
            return Connect.cnSQL.ExecQuery("Select * from WGhiChu where MaWeb='" + MaWeb + "'");
        }
        public static bool Them(TTWGhiChu WGhiChu)
        {
            Connect.cnSQL.ExecNonQuery("Insert into WGhiChu values('" + WGhiChu.Code + "','" + WGhiChu.MaWeb + "','" + WGhiChu.ThoiGian + "',N'" + WGhiChu.GhiChu + "')");
            return (!Connect.Tools.CoLoi);
        }
        public static bool Sua(TTWGhiChu WGhiChu)
        {
            Connect.cnSQL.ExecNonQuery("Update WGhiChu Set MaWeb='" + WGhiChu.MaWeb + "', ThoiGian='" + WGhiChu.ThoiGian + "', GhiChu=N'" + WGhiChu.GhiChu + "'  where Code='" + WGhiChu.Code + "'");
            return (!Connect.Tools.CoLoi);
        }
        public static bool Xoa(string Ma)
        {
            Connect.cnSQL.ExecNonQuery("Delete WGhiChu where Code ='" + Ma + "'");
            return (!Connect.Tools.CoLoi);
        }
    }
}
